<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="/js/axios.min.js"></script>
<script src="/js/util.js"></script>
<script>
    window.onload = function (){
        cutAll(1);
    }

    function cutAll(pageNO){
        axios.get("/role/cutAll",{
            params:{
                pageNO
            }
        }).then(e => {
            var info = e.data;
            var str = "";
            for (var i=0;i<info.records.length;i++){
                var obj = info.records[i];
                str += `<tr><td>${obj.name}</td><td><a href="/role/updateRole.html?id=${obj.id}">修改角色权限</a></td></tr>`;
            }
            $('roleData').innerHTML = str;

            var pageStr = "";
            for (var i=1;i<=info.pages;i++){
                pageStr += `<a href="javascript:cutAll(${i})">${i}</a>`
            }
            $('cutDiv').innerHTML = pageStr;
        })
    }
</script>
<body>
    <h2>角色管理</h2>
    <table border="1" cellspacing="0" width="98%">
        <thead>
            <tr>
                <th>角色名称</th><th>操作</th>
            </tr>
        </thead>
        <tbody id="roleData"></tbody>
    </table>
    <div id="cutDiv"></div>
    <a href="/role/addRole.html">添加角色</a>
</body>
</html>